package ezXpns.GUI;

import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;

import net.miginfocom.swing.MigLayout;
/**
 * 
 * @author A0086894H
 *
 */


//@author A0086894H
public class ProfilePanel extends JPanel {

	public ProfilePanel(String name, String imagePath){
		this.name = name;
		setLayout(new MigLayout("fillx", "[128.00px][128.00px]", "[][]"));
		setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
		// label: profile picture
		{
			ImageIcon profileImg = new ImageIcon(imagePath); 		
			JLabel lblPicture = new JLabel (profileImg);
			add(lblPicture, "cell 0 0,alignx left,aligny top");
		}
		// label: profile name
		{
			JLabel lblName = new JLabel ();
			lblName.setText(name); // name of profile
			lblName.setFont(new Font("Century Gothic", Font.BOLD, 30)); 
			add(lblName, "cell 1 0,alignx left,aligny center");
		}
		
		// listeners for clicking
		addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent mousePress) {
				setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
			}
		});
		addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased (MouseEvent mouseRelease) {
				setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null));
			}
		});
	}
	
	public String getName(){
		return name;
	}

	private static final long serialVersionUID = 1L;
	private String name;
}